package top.xunfong.probe.service.impl;

import cn.hutool.json.JSONUtil;
import top.xunfong.api.probe.constant.ProbeConstant;
import top.xunfong.api.probe.domain.dto.ProbeDTO;
import top.xunfong.probe.service.ProbeService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.kafka.core.KafkaTemplate;
import org.springframework.stereotype.Service;

@Service
public class ProbeToKafkaServiceImpl implements ProbeService {

    @Autowired
    private KafkaTemplate<String, String> kafkaTemplate;


    @Override
    public void send(ProbeDTO dto) {
        kafkaTemplate.send(ProbeConstant.TOPIC, JSONUtil.toJsonStr(dto));
    }
}
